import 'package:dustbin_sort/model/select_res_entity.dart';

selectResEntityFromJson(SelectResEntity data, Map<String, dynamic> json) {
	if (json['total'] != null) {
		data.total = json['total']?.toInt();
	}
	if (json['list'] != null) {
		data.xList = new List<SelectResList>();
		(json['list'] as List).forEach((v) {
			data.xList.add(new SelectResList().fromJson(v));
		});
	}
	if (json['pageNum'] != null) {
		data.pageNum = json['pageNum']?.toInt();
	}
	if (json['pageSize'] != null) {
		data.pageSize = json['pageSize']?.toInt();
	}
	if (json['size'] != null) {
		data.size = json['size']?.toInt();
	}
	if (json['startRow'] != null) {
		data.startRow = json['startRow']?.toInt();
	}
	if (json['endRow'] != null) {
		data.endRow = json['endRow']?.toInt();
	}
	if (json['pages'] != null) {
		data.pages = json['pages']?.toInt();
	}
	if (json['prePage'] != null) {
		data.prePage = json['prePage']?.toInt();
	}
	if (json['nextPage'] != null) {
		data.nextPage = json['nextPage']?.toInt();
	}
	if (json['isFirstPage'] != null) {
		data.isFirstPage = json['isFirstPage'];
	}
	if (json['isLastPage'] != null) {
		data.isLastPage = json['isLastPage'];
	}
	if (json['hasPreviousPage'] != null) {
		data.hasPreviousPage = json['hasPreviousPage'];
	}
	if (json['hasNextPage'] != null) {
		data.hasNextPage = json['hasNextPage'];
	}
	if (json['navigatePages'] != null) {
		data.navigatePages = json['navigatePages']?.toInt();
	}
	if (json['navigatepageNums'] != null) {
		data.navigatepageNums = json['navigatepageNums']?.map((v) => v?.toInt())?.toList()?.cast<int>();
	}
	if (json['navigateFirstPage'] != null) {
		data.navigateFirstPage = json['navigateFirstPage']?.toInt();
	}
	if (json['navigateLastPage'] != null) {
		data.navigateLastPage = json['navigateLastPage']?.toInt();
	}
	if (json['firstPage'] != null) {
		data.firstPage = json['firstPage']?.toInt();
	}
	if (json['lastPage'] != null) {
		data.lastPage = json['lastPage']?.toInt();
	}
	return data;
}

Map<String, dynamic> selectResEntityToJson(SelectResEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['total'] = entity.total;
	if (entity.xList != null) {
		data['list'] =  entity.xList.map((v) => v.toJson()).toList();
	}
	data['pageNum'] = entity.pageNum;
	data['pageSize'] = entity.pageSize;
	data['size'] = entity.size;
	data['startRow'] = entity.startRow;
	data['endRow'] = entity.endRow;
	data['pages'] = entity.pages;
	data['prePage'] = entity.prePage;
	data['nextPage'] = entity.nextPage;
	data['isFirstPage'] = entity.isFirstPage;
	data['isLastPage'] = entity.isLastPage;
	data['hasPreviousPage'] = entity.hasPreviousPage;
	data['hasNextPage'] = entity.hasNextPage;
	data['navigatePages'] = entity.navigatePages;
	data['navigatepageNums'] = entity.navigatepageNums;
	data['navigateFirstPage'] = entity.navigateFirstPage;
	data['navigateLastPage'] = entity.navigateLastPage;
	data['firstPage'] = entity.firstPage;
	data['lastPage'] = entity.lastPage;
	return data;
}

selectResListFromJson(SelectResList data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['type'] != null) {
		data.type = json['type']?.toInt();
	}
	return data;
}

Map<String, dynamic> selectResListToJson(SelectResList entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['type'] = entity.type;
	return data;
}